package com.GUI.lesson01;

import java.awt.*;

public class TestFrame2 {
    public static void main(String[] args) {
        //展示多个窗口
        MyFrame frame1 =new MyFrame(100,100,200,200,Color.black);
        MyFrame frame2 =new MyFrame(310,100,200,200,Color.black);
        MyFrame frame3 =new MyFrame(100,310,200,200,Color.black);
        MyFrame frame4 =new MyFrame(310,310,200,200,Color.black);
    }
}

//封装
class MyFrame extends Frame {
    //多个窗口，我们需要一个计数器
    static int id = 0;
    //拿到位置和大小
    public MyFrame(int x,int y,int w,int h,Color color){
        super("MyFrame" + (++id));
        setVisible(true);
        setBackground(color);
        setSize(w,h);
        setLocation(x,y);

    }
}
